import request from '@/utils/request'

// 查询失效详细
export function getFailure(id) {
  return request({
    url: '/fmea/common/failure/' + id,
    method: 'get'
  })
}

// 新增失效
export function addFailure(data) {
  return request({
    url: '/fmea/common/failure',
    method: 'post',
    data: data
  })
}

// 批量新增失效
export function addBatchFailure(data) {
  return request({
    url: '/fmea/common/failure',
    method: 'post',
    data: data
  })
}

// 修改失效
export function updateFailure(data) {
  return request({
    url: '/fmea/common/failure',
    method: 'put',
    data: data
  })
}

// 删除失效
export function delFailure(data) {
  return request({
    url: '/fmea/common/failure/' + data.id,
    method: 'delete'
  })
}

// 检查失效是否唯一
export function checkFailureUnique(params) {
  return request({
    url: '/fmea/common/failure/check',
    method: 'get',
    params: params
  })
}

export function saveRelation(data) {
  return request({
    url: `/fmea/common/failure/saveRelation`,
    method: 'get',
    params: data
  })
}

export function disRelation(data) {
  return request({
    url: `/fmea/common/failure/deleteRelation`,
    method: 'get',
    params: data
  })
}
